clearvars -except Globaloption option 

%% Saving parameter estimates to automatically update the paper
fID = fopen('../../results/tables_main/UK/preWWI/TableEst_preWWI_UK_cy_partial.tex', 'w');


%% Baseline Results

loaddata_4CIjoint_annual_cy_partial;

fprintf(fID,'\\newcommand{\\cymeanUKpreWWIlongbps}{%4.0f}\n',mean(cy_long*10000));
fprintf(fID,'\\newcommand{\\cymeanUKpreWWIlongpct}{%4.2f}\n',mean(cy_long)*100);
fprintf(fID,'\\newcommand{\\cymeanUKpreWWIshortbps}{%4.0f}\n',mean([cy_short]*10000));

fprintf(fID,'\\newcommand{\\cymeanUKpreWWIlongonebps}{%4.0f}\n',round(mean([cy_long]*10000)));
fprintf(fID,'\\newcommand{\\cymeanUKpreWWIlongtwobps}{%4.0f}\n',round(mean([cy_long]*10000)));


fprintf(fID,'\\newcommand{\\cygdpmeanUKpreWWI}{%4.2f}\n',mean(seig_rev)*100);


filename = ['MAT/cy_UK_30'];
load (filename);
fprintf(fID,'\\newcommand{\\upperUKcypreWWI}{%4.2f}\n',upper);
fprintf(fID,'\\newcommand{\\upperUKcypreWWIpct}{%4.2f}\n',upper*100);
fprintf(fID,'\\newcommand{\\smeanUKcypreWWI}{%4.2f}\n',mean(s));
fprintf(fID,'\\newcommand{\\smeanUKcypreWWIpct}{%4.2f}\n',mean(s)*100);
fprintf(fID,'\\newcommand{\\preWWIukpvscytodebt}{%4.2f}\n',100*nanmean(s)/nanmean(gdebt));
fprintf(fID,'\\newcommand{\\preWWIukcorrpvscydebt}{%4.2f}\n',corr(gdebt(2:end), s'));
fprintf(fID,'\\newcommand{\\preWWIukuppertodebt}{%4.2f}\n',100*upper/nanmean(gdebt));


filename = ['MAT/cy_UK_20'];
load (filename);
fprintf(fID,'\\newcommand{\\upperUKpreWWIcytwenty}{%4.2f}\n',upper);
fprintf(fID,'\\newcommand{\\upperUKpreWWIcypcttwenty}{%4.2f}\n',upper*100);
fprintf(fID,'\\newcommand{\\smeanUKpreWWIcytwenty}{%4.2f}\n',mean(s));
fprintf(fID,'\\newcommand{\\smeanUKpreWWIcypcttwenty}{%4.2f}\n',mean(s)*100);
fprintf(fID,'\\newcommand{\\preWWIukpvscytodebttwenty}{%4.2f}\n',100*nanmean(s)/nanmean(gdebt));
fprintf(fID,'\\newcommand{\\preWWIukcorrpvscydebttwenty}{%4.2f}\n',corr(gdebt(2:end), s'));
fprintf(fID,'\\newcommand{\\preWWIukuppertodebttwenty}{%4.2f}\n',100*upper/nanmean(gdebt));

load MAT/cy_UK_30_1760.mat
fprintf(fID,'\\newcommand{\\upperUKIR}{%4.2f}\n',upper);
fprintf(fID,'\\newcommand{\\upperUKIRpct}{%4.2f}\n',upper*100);
fprintf(fID,'\\newcommand{\\smeanUKIR}{%4.2f}\n',mean(s));
fprintf(fID,'\\newcommand{\\smeanUKIRpct}{%4.2f}\n',mean(s)*100);
fprintf(fID,'\\newcommand{\\IRukpvscytodebt}{%4.2f}\n',100*nanmean(s)/nanmean(gdebt));
fprintf(fID,'\\newcommand{\\IRukcorrpvscydebt}{%4.2f}\n',corr(gdebt(2:end), s'));
fprintf(fID,'\\newcommand{\\IRukmeandebtpct}{%4.2f}\n',100*nanmean(gdebt));



%% Close File
fclose(fID); 

